package com.ruoyi.web.controller.persona;

import com.ruoyi.common.constant.CustomerPersonaAgents;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.smartai.service.IPersonaAgentsService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * 客服Agents
 */
@RestController
@Api("客服Agents")
@RequestMapping("/persona/agent")
public class AgentsController  extends BaseController {


    @Autowired
    private IPersonaAgentsService personaAgentsService;


    /**
     * 获取Agent数据
     *
     * @param contactNumber
     * @return
     */
    @PreAuthorize("@ss.hasPermi('persona:identity:list')")
    @GetMapping("/get/{contactNumber}")
    public AjaxResult getPersonaAgentsByNumber(@PathVariable String contactNumber) {
        return success(personaAgentsService.getPersonaAgentsByNumber(contactNumber));
    }

    /**
     * 更新Agent数据
     *
     * @param agents
     * @return
     */
    @PreAuthorize("@ss.hasPermi('persona:identity:list')")
    @PutMapping("/update")
    public AjaxResult updateAgents(@Validated @RequestBody CustomerPersonaAgents agents) {
        return success(personaAgentsService.updateAgents(agents));
    }


}
